@extends('admin.master')

@section('top')
	<div class="top-breadcrumb pull-left">{!! Breadcrumbs::render('admin.customer-note.index', $customer->id) !!}</div>
	<div class="top-btn-group pull-right">
		<a href="{{ route('admin.customer-note.create', ['cid'=>$customer->id]) }}" class="btn btn-primary">写笔记</a>
	</div>
@endsection

@section('content')
<div class="container-common common-text mark-body">
	<div class="customer-notes panel panel-default">
		<div class="panel-heading">
			<h1 class="note-name">{{ $customer->name }}</h1>
		</div>
		<div class="panel-body">
		@if (!$notes->isEmpty())
			<ul class="note-list">
			@foreach($notes as $value)
				<li class="{{ ($value->user_id == $user->id) ? 'note-edit' : ''  }}">
					<div class="pull-left note-date">
						<div class="note-meta">
							<span class="meta-date-value">{{ $value->updated_at->format('Y-m-d') }}</span>
							<span class="meta-name">{{ $value->user->name }}</span>
						</div>
					</div>
					<div class="note-content">
						<h2 class="note-title">
							{{ $value->title }}
						</h2>
						<div class="note-body">{!! $value->content !!}</div>
					</div>
					@if ($value->user_id == $user->id || $user->isAdmin())
						<div class="customer-note-action">
							<a href="{{ route('admin.customer-note.edit', $value->id) }}" class="note-edit-link">重新编辑</a>
							<span class="text-explode ">|</span>
							<a href="javascript:void(0);" data-id="{{ $value->id }}" class="btn-link delete-item">删除</a>
						</div>
					@endif
				</li>
			@endforeach
			</ul>
		@else
			<p>暂时还没有内容...</p>
		@endif
		</div>
	</div>
</div>
@endsection

@section('foot')

@endsection